package com.tianpengtech.admin.role;


import com.tianpengtech.common.model.role.Role;

import java.util.List;

public class RoleDao {

    public static final RoleDao ME = new RoleDao();
    /*
        获取指定的ROLE对象
     */
    public Role readRole(String code){
        String sql="select * from "+Role.dao.tableName()+" where "+Role.CODE+" =? limit 1";
        return Role.dao.findFirst(sql,code);
    }


    public List<Role> readAllRoles(){

        String sql="select * from "+Role.dao.tableName()+" order by id desc";
        return Role.dao.find(sql);
    }
}
